<template>
	<view class="map">

		<!-- 腾讯地图Api  key:腾讯地图key -->
		<web-view
			src="https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=SFABZ-WANWW-FISRY-3IGTF-HV7RE-YSFTI&referer=myapp"
			@message="onMessage"></web-view>
	</view>
</template>

<script>
	// 引入设置地址存储工具
	import {
		setlocation
	} from './utils.js'
	export default {
		data() {
			return {

			}
		},
		onLoad(options) {
		},

		methods: {
			onMessage(event) {
				const message = event.detail.data;
				if (message && message.event === 'locationResult') {
					const location = {
						poiaddress: message.data.poiaddress,
						poiname: message.data.poiname,
						latlng: message.data.latlng
					};
					setlocation(location);
					uni.navigateBack()
				}
			}
		}
	}
</script>

<style></style>